﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<List<Entity.UserBase_Ext>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    主页
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <style type="text/css">
        .list li { float: left; width: auto; list-style-type: none; padding-right: 10px; width: 100px; }
        .clear { clear: both; }
    </style>
    <script type="text/javascript">
        $(function () {
            $(".list>li:lt(4)").attr("style", "background-color:#eee;font-weight:bold;font-size:14px");
        });

        function deleteItem(itemID) {
            art.dialog.confirm('你确认执行操作？', function () {
                $.ajax({
                    type: "POST",
                    dataType: "json",
                    url: "/Home/Delete",
                    data: { id: itemID },
                    success: function (data) {
                        art.dialog({
                            icon: "succeed",
                            content: "操作成功",
                            lock: true,
                            opacity: 0.50,
                            id: "subLoading",
                            time: 5,
                            init: function () { location.href = location.href; }
                        });

                    }
                });
            }, function () { });
        }
        var res = '';
        //加密
        function ensFun(o) {
            $.ajax({
                type: "POST",
                url: "/home/EnsForJS",
                data: { str: o },
                dataType: "text",
                success: function (data) {
                    $("#ens").val(data);
                }
            })
        }
        //解密
        function desFun(o) {
            $.ajax({
                type: "POST",
                url: "/home/DesForJS",
                data: { str: o },
                dataType: "text",
                success: function (data) {
                    $("#des").val(data);
                }
            })
        }
        $(function () {
            ensFun("123");
            desFun("R3tronm5rhA%3d");
        });
 
    </script>
    <%
        Writer.Write(Convert.ToDecimal(VCommons.Encryptor.Utility.DecryptString(VCommons.Utils.UrlDecode("66EFD09D642324AD"))));

    %>
    <ul class="list">
        <li>编号</li><li>用户</li><li>邮箱</li><li>姓名</li><li>说明</li><li>操作</li><li class='clear'>
        </li>
        <%if (Model != null && Model.Count > 0)
          {
              foreach (var i in Model)
              {
                  Writer.Write(@"<li>{0}</li><li>{1}</li><li>{2}</li><li>{5}</li><li>{6}</li><li>{3}|{4}</li><li class='clear'></li>"
                      , i.UserBase.ID
                  , i.UserBase.UserName
                  , i.UserBase.Email
                  , Html.ActionLink("编辑", "Edit", new { id = i.UserBase.ID })
                  , Html.ActionLink("删除", "deleteItem(\"" + i.UserBase.ID + "\")"
                  , Entity.CommonEnums.UserOperatorRole.DeleteEvent), i.UserInfo.RealName, i.UserInfo.Info);
                  if (i.User_Diary != null)
                      i.User_Diary.ToList().ForEach(j => Response.Write(j.Title));
              }
          }
        %>
    </ul>
    <div class="clear">
    </div>
    <%=Html.ActionLink("添加","Create") %>
    分类：
    <%=Html.SelectList_Category() %>
</asp:Content>
